home *** CD-ROM | disk | FTP | other *** search
/ PC User 2003 December / Australian PC User - December 2003 (CD2).iso / software / apps / files / dwmx2k4.exe / Disk1 / data1.cab / Configuration_En / Commands / Customize Favorites.js < prev    next >
Encoding:
JavaScript  |  2003-09-05  |  2.6 KB  |  110 lines

  1. // Copyright 2003 Macromedia, Inc. All rights reserved.
  2.  
  3. // *************** GLOBALS VARS *****************
  4. var helpDoc = MM.HELP_customizeFavorites; 
  5. var AVAILABLE_OBJECTS_LIST; 
  6. var FAVORITE_OBJECTS_LIST; 
  7. var myCustomizeFavorites; 
  8.  
  9. // ******************* API **********************
  10.  
  11. function commandButtons()
  12. {
  13.   return new Array(MM.BTN_OK, "clickedOK()", MM.BTN_Cancel, "window.close()",MM.BTN_Help, "displayHelp()"); 
  14. }
  15.  
  16. //***************** LOCAL FUNCTIONS  ******************
  17.  
  18. function initializeUI()
  19. {
  20.   // create list controls 
  21.   AVAILABLE_OBJECTS_LIST = new ListControl("availableObjects");
  22.   FAVORITE_OBJECTS_LIST  = new ListControl("favoriteObjects");   // if we have a valid DOM 
  23.   AVAILABLE_CATEGORIES_LIST = new ListControl("availableCategories"); 
  24.  
  25.   myCustomizeFavorites = new CustomizeFavorites(AVAILABLE_OBJECTS_LIST,FAVORITE_OBJECTS_LIST,AVAILABLE_CATEGORIES_LIST); 
  26.  
  27.   myCustomizeFavorites.initializeUI(); 
  28.  
  29.   updateUI("availableObjects"); 
  30. }
  31.  
  32. function updateUI(itemName)
  33. {
  34.   switch(itemName)
  35.   {
  36.     case "addButton":
  37.     {
  38.       myCustomizeFavorites.addFavorite(); 
  39.       break;
  40.     }
  41.     case "deleteButton":
  42.     {
  43.       myCustomizeFavorites.deleteFavorite(); 
  44.       break;
  45.     }
  46.     case "addSeparator": 
  47.     {
  48.       myCustomizeFavorites.addSeparator(); 
  49.       break;
  50.     }
  51.     case "upButton": 
  52.     {
  53.       myCustomizeFavorites.upButton()
  54.       break;
  55.     }    
  56.     case "downButton": 
  57.     {
  58.       myCustomizeFavorites.downButton()
  59.       break;
  60.     }    
  61.     case "availableObjects": 
  62.     {
  63.       if (!AVAILABLE_OBJECTS_LIST.getValue())
  64.       {
  65.         myCustomizeFavorites.setAddButtonDisabled(true);  
  66.       }
  67.       else
  68.       {
  69.         myCustomizeFavorites.setAddButtonDisabled(false);        
  70.       }
  71.       break; 
  72.     }
  73.  
  74.     case "availableObjectsDoubeClick": 
  75.     {
  76.       updateUI('addButton'); 
  77.       break; 
  78.     }
  79.     case "getAvailableSelected":
  80.     {
  81.       alert(FAVORITE_OBJECTS_LIST.get() + "\n\r" + FAVORITE_OBJECTS_LIST.getValue()); 
  82.       break; 
  83.     }
  84.     case "availableCategories": 
  85.     {
  86.       var curCatValue = this.AVAILABLE_CATEGORIES_LIST.getValue(); 
  87.  
  88.       if (curCatValue.toLowerCase() == "all") 
  89.       {
  90.         myCustomizeFavorites.setAvailableObjects("all"); 
  91.       } 
  92.       else
  93.       {
  94.         myCustomizeFavorites.setAvailableObjects(curCatValue);
  95.       }
  96.       
  97.       // make sure to notify the availableObjects list so that it can
  98.       // update the add button 
  99.       updateUI("availableObjects"); 
  100.       
  101.       break; 
  102.     }
  103.   }
  104. }
  105.  
  106. function clickedOK()
  107. {
  108.   myCustomizeFavorites.store(); 
  109.   dw.objectPalette.setActiveCategory('Favorites');
  110. }